package com.gk.javaservice.service.impl;

import com.gk.javaservice.dao.AdminRolesDao;
import com.gk.javaservice.po.AdminRoles;
import com.gk.javaservice.service.AdminRolesService;
import com.gk.javaservice.util.time.TimeUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AdminRolesServiceImpl implements AdminRolesService {

    @Autowired
    private AdminRolesDao baseDao;


    @Override
    public void add(AdminRoles adminRoles) {
        String getTime = TimeUtil.dateFormat();
        adminRoles.setCreatedAt(getTime);
        adminRoles.setUpdatedAt(getTime);
        baseDao.add(adminRoles);
    }

    @Override
    public Integer update(AdminRoles adminRoles) {
        String getTime = TimeUtil.dateFormat();
        adminRoles.setUpdatedAt(getTime);
        return baseDao.update(adminRoles);
    }

    @Override
    public Integer delete(Object id) {
        return baseDao.delete(id);
    }

    @Override
    public List<AdminRoles> hasAll() {
        return baseDao.hasAll();
    }

    @Override
    public AdminRoles hasById(Object id) {
        return baseDao.hasById(id);
    }

    @Override
    public List<AdminRoles> search(String searchMsg) {
        return baseDao.search(searchMsg);
    }
}
